<?php
namespace Home\Controller;
use Think\Controller;
class ArticleController extends Controller {

       public function index(){
        $arid=I('arid');
    	$article=D('article');
    	$articles=$article->find($arid);

        $count=$article->count();// 查询满足要求的总记录数
        $Page=new \Think\Page($count,8);// 实例化分页类 传入总记录数和每页显示的记录数(25)
        $show= $Page->show();// 分页显示输出
        $list = $article->limit($Page->firstRow.','.$Page->listRows)->select();
        $this->assign('list',$list);// 赋值数据集
        $this->assign('page',$show);// 赋值分页输出
        $articles=$article->select();
        
         // var_dump($articles); exit;
        $data = array();
        foreach ($articles as  $v) {
           
            $data[] = $v;
            
        }
        // var_dump($data); exit;
       
        $this->assign('data',$data);
    	// $this->assign('contents',$data['con']);
    	
    	/*$front=$article->where("id<".$arid)->order('id desc')->limit('1')->find();
    	if($front){
    		$furl=__CONTROLLER__.'/index/arid/'.$front['id'];
    	}else{
    		$furl="javascript:void(0);";
    	}
        
    	//下一页
    	$after=$article->where("id>".$arid)->order('id asc')->limit('1')->find();
    	if($after){
    		$aurl=__CONTROLLER__.'/index/arid/'.$after['id'];
    	}else{
    		$aurl="javascript:void(0);";
    	}
    	$this->assign('aurl',$aurl);
    	$this->assign('furl',$furl);*/

       
       $this->display();
    }

}